package com.et114.components.acegi.acl.domain;

import org.acegisecurity.acl.basic.AclObjectIdentity;
import org.acegisecurity.acl.basic.AclObjectIdentityAware;
import org.acegisecurity.acl.basic.NamedEntityObjectIdentity;

import java.io.Serializable;

/**
 * 实现了AclObjectIdentityAware接口，这样在后期构造AclObjectIdentity的时候就可以直接调用该接口的getAclObjectIdentity方法取得
 * @author guanhw
 * @see AclObjectIdentityAware
 * @see AclObjectIdentity
 * @see BasicAclProvider
 */
public class AclDomainBuilder implements AclObjectIdentityAware {

    private Class domainClass;
    private Serializable id;


    public AclDomainBuilder(Class domainClass, Serializable id) {
        this.domainClass = domainClass;
        this.id = id;
    }


    public AclObjectIdentity getAclObjectIdentity() {
        return new NamedEntityObjectIdentity(domainClass.getName(), id.toString());
    }


    public Class getDomainClass() {
        return domainClass;
    }


    public void setDomainClass(Class domainClass) {
        this.domainClass = domainClass;
    }


    public Serializable getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = id;
    }

}
